package kmdigit.shop.dao.persistence.ibatis;

import kmdigit.shop.dao.domain.Item;
import kmdigit.shop.dao.persistence.ItemDao;

import com.ibatis.dao.client.DaoManager;
import com.ibatis.dao.client.template.SqlMapDaoTemplate;

public class ItemDaoImpl extends SqlMapDaoTemplate implements ItemDao {

	public ItemDaoImpl(DaoManager daoManager) {
		super(daoManager);
	}

	@Override
	public int delete(Item item) {
		return delete(item.getItemid());
	}
	
	@Override
	public int delete(String itemId)
	{
		return delete("Item.delete", itemId);
	}

	@Override
	public Item getById(String itemId) {
		return (Item) queryForObject("Item.getById", itemId);
	}

	@Override
	public Item getById(Item item) {
		return getById(item.getItemid());
	}

	@Override
	public Integer insert(Item item) {
		return (Integer) insert("Item.insert", item);
	}

	@Override
	public int update(Item item) {
		return update("Item.update", item);
	}
}
